package ovm.gui.forms.load;

import ovm.entity.LoadSubjectEntity;
import ovm.gui.forms.AbstractEntityForm;
import ovm.management.AbstractManager;
import ovm.management.load.LoadManager;

import static ovm.application.MainApplication.navigator;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 14.06.12
 * Time: 23:46
 * To change this template use File | Settings | File Templates.
 */

public class LoadSubjectEntityForm extends AbstractEntityForm {
    public LoadSubjectEntityForm(Object entity, Boolean editable) {
        super(entity, editable);
    }

    @Override
    public void commit() {
        if (LoadManager.persistOrDeleteLoadSubjectEntity((LoadSubjectEntity) entity, false) == 0) {
            navigator.showNotification("Дисциплина успешно добавлена");
            setVisible(false);
        } else {
            navigator.showNotification("Произошла ошибка при добавлении новой сущности");
        }
    }

}
